package com.zyx.springmvc.view.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author Yaxi.Zhang
 * @since 2021/9/15 09:55
 */
@Controller
public class ViewController {

    @SuppressWarnings("SpringMVCViewInspection")
    @RequestMapping("/testThymeleafView")
    public String testThymeleafView(){
        return "success";
    }

    @SuppressWarnings("SpringMVCViewInspection")
    @RequestMapping("/view")
    public String testView(){
        return "view";
    }


    @RequestMapping("/testForward")
    public String testForward(){
        return "forward:/testThymeleafView";
    }

    @RequestMapping("/testRedirect")
    public String testRedirect(){
        return "redirect:/testThymeleafView";
    }

    @SuppressWarnings("SpringMVCViewInspection")
    @RequestMapping("/testMap")
    public String testMap(Map<String, Object> map){
        map.put("testRequestScope", "hello,map");
        System.out.println(map.getClass().getName());
        return "success";
    }


}
